<template>
	<page-container boxBackground="transparent" :base-tab="2" :shownav="true" navtitle="提建议" :istabbox="true">
		<view class="list">
			<view v-for="(item,index) in dataList" :key="index" class="list-item" :class="'bjimg_'+item.index"
				@click="goSubPage(item.url)">
				<image :src="item.icon" class="img"></image>
				<view class="desc">
					<view class="title">{{ item.title }}</view>
					<view class="subtitle">{{ item.subtitle }}</view>
				</view>
			</view>
		</view>
	</page-container>
</template>

<script>
	import {
		cppccProposalPage,
		deputyToTheNationalPeopleSCongressPage,
		partyRepresentativePage,
		popularWillPage,
		snapshotPage
	} from "@/util/publicConfig";
	import {
		baseMixins
	} from "@/util/baseMixins";
	import {
		getUserInfo,
		initUserInfo
	} from "@/service/user";

	export default {
		mixins: [baseMixins],
		name: "index",
		data() {
			return {
				baseDataList: [{
						title: '党代表意见提交',
						subtitle: '由区组织部审核，立案后由承办单位进行办理',
						icon: '/static/img/advise/ddb.png',
						url: partyRepresentativePage,
						showFiledName: 'partyAuth',
						index: 0,
					},
					{
						title: '人大建议',
						subtitle: '由区人大审核，立案后由承办单位进行办理',
						icon: '/static/img/advise/rddb.png',
						url: deputyToTheNationalPeopleSCongressPage,
						showFiledName: 'npcAuth',
						index: 1,
					},
					{
						title: '政协提案',
						subtitle: '由区政协审核，立案后由承办单位进行办理',
						icon: '/static/img/advise/zx.png',
						url: cppccProposalPage,
						showFiledName: 'govAuth',
						index: 2,
					},
					{
						title: '政协委员社情民意',
						subtitle: '由区政协审核，向区领导请示',
						icon: '/static/img/advise/zx.png',
						url: popularWillPage,
						showFiledName: 'govAuth',
						index: 3,
					},
					{
						title: '监督随手拍',
						subtitle: '由区纪委监委审核，通过后由承办单位纪检组协调处理',
						icon: '/static/img/advise/ssp.png',
						url: snapshotPage,
						index: 4,
					}
				],
				dataList: [],
			}
		},
		onLoad() {
			let owner = this
			initUserInfo().then(userInfo => {
				owner.dataList = owner.baseDataList.filter(dataItem => {
					return dataItem.showFiledName == null || userInfo[dataItem.showFiledName] == 1
				})
			})
		},
	}
</script>

<style scoped lang="scss">
	.list {
		box-sizing: border-box;
		padding: 20rpx;
		width: 100%;
		height: 100%;
		overflow: auto;

		.bjimg_0 {
			background-image: url(@/static/img/advise/ddb_bg.png);
		}

		.bjimg_1 {
			background-image: url(@/static/img/advise/rddb_bg.png);
		}

		.bjimg_2 {
			background-image: url(@/static/img/advise/item_bg_1.png);
		}

		.bjimg_3 {
			background-image: url(@/static/img/advise/item_bg_4.png);
		}

		.bjimg_4 {
			background-image: url(@/static/img/advise/item_bg_3.png);
		}

		.list-item {
			display: flex;
			align-items: center;
			margin: 30rpx 0;
			padding-left: 40rpx;
			height: 200rpx;
			background-size: 100% 100%;
			border-radius: $border-radius-lg;


			image {
				width: 100rpx;
				height: 100rpx;
				border-radius: 100%;
				margin-right: 20rpx;
			}

			.desc {
				display: flex;
				flex-direction: column;
				color: #fff;
				width: calc(100% - 140rpx);

				.title {
					font-family: Source Han Sans SC, Source Han Sans SC;
					font-weight: 500;
					font-size: 34rpx;
					color: #FFFFFF;
					line-height: 45rpx;
				}

				.subtitle {
					font-family: Source Han Sans SC, Source Han Sans SC;
					font-weight: 400;
					font-size: 28rpx;
					color: #FFFFFF;
					line-height: 45rpx;
				}
			}
		}
	}
</style>